#ifndef _FD_H_
#define _FD_H_

#include "Equations/ScalarEquation.hpp"

namespace Tuna {
  
  template <typename T, int Dim> class FD;
  
  template <typename T>
  struct Typeinfo <FD<T, 1> > {
    typedef T prec_t;
    enum { Dim = 1 };
  };
  
  template <typename T>
  struct Typeinfo <FD<T, 2> > {
    typedef T prec_t;
    enum { Dim = 2 };
  };
  
  template <typename T>
  struct Typeinfo <FD<T, 3> > {
    typedef T prec_t;
    enum { Dim = 3 };
  };
  
  template<typename Tprec, int Dim>
  class FD : public ScalarEquation<FD< Tprec, Dim > >
  {
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::aE;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::aW;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::aN;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::aS;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::aF;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::aB;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::aP;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::sp;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::dx;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::dy;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::dz;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::bi;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::ei;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::bj;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::ej;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::bk;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::ek;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::dt;    
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::applyBoundaryConditions1D;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::applyBoundaryConditions2D;
    using GeneralEquation<ScalarEquation<FD<Tprec, Dim > > >::applyBoundaryConditions3D;

    using ScalarEquation<FD<Tprec, Dim > >::Gamma;
    using ScalarEquation<FD<Tprec, Dim > >::phi_0;
    
  public:
    typedef Tprec prec_t;
    typedef typename TunaArray<prec_t, Dim >::huge ScalarField;
    
    FD() : ScalarEquation<FD<prec_t, Dim> >() { }
    ~FD() { };

  /*!
   * FVM coefficients calculations in 1D.
   */
  inline bool calcCoefficients1D(); 

  /*!
   * FVM coefficients calculations in 2D.
   */
  inline bool calcCoefficients2D();

  /*!
   * FVM coefficients calculations in 3D.
   */
  inline bool calcCoefficients3D();    

    inline void printInfo() { std::cout << " FD "; }
  };
  
} // Tuna namespace

#include "../../src/Schemes/FD.cpp"

#endif //_FD_H_

















